﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace WorkItemCollaborator
{
    public sealed class ChangedFieldCollectionToStringConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var changedFieldsCollection = (Collection<ChangedField>)value;
            StringBuilder valueBuilder = new StringBuilder();
            if (changedFieldsCollection != null)
            {
                foreach (var changedField in changedFieldsCollection)
                {
                    valueBuilder.Append(changedField.FieldName+", ");
                }
            }
            return valueBuilder.ToString();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
